<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class OrderResource extends JsonResource
{
    /**
     * 订单创建成功返回
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'order_id' => $this->id,
            'order_sn' => $this->order_sn,
            'created_at' => $this->created_at->toDateTimeString(),
            'total_amount' => $this->total_amount
        ];
    }
}
